package com.atguigu.yygh.oss.service;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

//在这个类上批量的读取
//好处: 类名.静态属性名
@Component
public class OssConstantProperties implements InitializingBean {
    @Value("${oss.endpoint}")
    String endpoint;
    @Value("${oss.bucket}")
    String bucket;

    public static String ENDPOINT;
    public static String BUCKET;

    //该方法在@Value赋值成功后,会执行
    //将两个属性赋值给静态属性
    @Override
    public void afterPropertiesSet() throws Exception {
        ENDPOINT=this.endpoint;
        BUCKET=this.bucket;
    }
}
